<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<script>
    for (let i = 0; i < 5; i++) {
        console.log(i);
    }
    //console.log("我在循环外：" + i);

    function fun(a,b=1){
        // b = b || 1;
        console.log(a + b);
    }
    fun(10);

    let fun1 = (a,b)=>{
        console.log(a);
        console.log(a+b);
    }
    fun1(20,30);

    let person = {
        name: "zhangsan",
        eat: function(a){
            console.log(this.name + "吃了" + a);
        },
        eat2: a=>console.log(person.name + "吃了" + a),
        eat3(a){
            console.log(this.name + "吃了" + a);
        }
    };
    person.eat("香蕉");
    person.eat2("香肠");
    person.eat3("鸡蛋");

    let p = {
        name: "zhangsan",
        age: 24
    }
    let f1 = ({name, age}) => console.log(name, age);
    f1(p);
</script>
<body>

</body>
</html>